import { useNavigate, useParams, useSearchParams } from "react-router-dom"

function withRouter(WrapperComponent){
  return function(props){
    const navigate = useNavigate()
    const param = useParams()
    const query = useSearchParams()
    const router = {navigate,param,query}
    return <WrapperComponent {...props} router={router} />
  }
}

export default withRouter